def outer(logo):
    def inner(msg):
        print(f"<{logo}><{msg}><{logo}>")
    return inner    
fn1 = outer("第一")
fn1("哈哈")
fn1("呵呵")
fn1 = outer("第二")
fn1("啊啊")
fn1("额额")
# --------
def ATM(balance):
    def change (num,type=True) -> int :
        nonlocal balance    # 使用nonlocal关键字修改外部函数的值
        if type == True:   # 存钱
            balance += num
            print(f"<存款>{num}元，当前余额:{balance}")
        else:   #取钱
            balance -= num
            print(f"<取款>{num}元，当前余额:{balance}")
        return balance  # 返回修改后的余额
    return change
atm = ATM(100)
atm(10)
atm(10,1)
for x in range(1,10):
    atm(x)
for x in range(10,20):
    atm(x,False)
res:int = atm(200)
print(res)